/**
 * 
 */
package cn.biplam.common.interfaces;

import cn.biplam.common.client.DbResource;
import cn.biplam.common.client.OperatorResult;
import cn.biplam.common.client.Sequence;
import cn.biplam.common.wrapper.ErrorMessage;

/**
 * Operator实现类的基础类
 * @author 	WangSong 2009-11-6 上午11:03:18
 * @version 1.0
 */
public abstract class OperatorBase {
	protected String userId;
	protected OperatorResult result;
	protected String opId;
	protected DbResource dbResource;

	//super(userId, result, opId, dbResource);
	/**
	 * 直接调用初始化方法
	 * @param userId
	 * @param result
	 * @param opId
	 * @param dbResource
	 */
	public OperatorBase(String userId,OperatorResult result,String opId,DbResource dbResource){
		this.userId=userId;
		this.result=result;
		this.opId=opId;
		this.dbResource=dbResource;
	}
	
	/**
	 * 根据表名和用户ID,生成记录ID
	 * @return 记录ID
	 * @throws ErrorMessage 
	 */
	public String generatorRowID() throws ErrorMessage{
		String rowID = Sequence.getSequence(userId); 
		this.result.setLastRowId(rowID);
		return rowID;	
	}
}
